<template>
    <div class="all">
        <div class="top">
            <div class="top_header">
                <h3>{{ act.actname }}</h3>
                <span>{{act.status}}</span>
            </div>
            <table>
                <tbody>
                    <tr>
                        <td>活动时间</td>
                        <td>{{ act.starttime }}—{{ act.endtime }}</td>
                    </tr>
                    <tr>
                        <td>活动地点</td>
                        <td>{{ act.actword }}</td>
                    </tr>
                    <tr>
                        <td>活动简介</td>
                        <td>{{ act.description }}</td>
                    </tr>
                    <tr>
                        <td>活动来源</td>
                        <td>{{ act.source }}</td>
                    </tr>
                    <tr>
                        <td>服务时长</td>
                        <td>{{ act.duration }}</td>
                    </tr>
                    <tr>
                        <td>招募人数</td>
                        <td>{{ act.recruitNum }}</td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="bottom">
            立即报名
        </div>
    </div>
</template>
<script setup>
import { getActByid } from '@/api/volunteerApi';
import { ref ,onMounted } from 'vue';
import { useRoute } from 'vue-router';
let route=useRoute()
let act=ref({
    id:'', //id
    actname:'', //志愿活动名称
    actword:'', //活动地点
    starttime:'', //活动开始时间
    endtime:'', //活动结束时间
    actpoint:'', //志愿积分
    status:'', //活动状态
    description:'', //活动简介
    source:'', //活动来源
    duration:'', //志愿时长
    recruitNum:'', //招募人数
})
onMounted(async ()=>{
    let id=route.params.id||0
    // console.log(id);    
    let res=await getActByid(id)
    console.log(res);
    Object.assign(act.value,res)
})
</script>
<style scoped>
.all{
    width: 100%;
    height: 100%;
    background-color: var(--bg-accent);
    display: flex;
    flex-direction: column;
    justify-content: space-between
}
.top{
    background-color: var(--white);
    padding: 10px 10px 0px 10px;
    padding-bottom: 10px;
}
.top_header{
    height: 80px;
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) 0;
}
.top_header>h3 {
    color: var(--text-primary);
    font-size: var(--font-xl);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}
.top_header>span{
    display: block;
    width: 80px;
    height: 25px;
    line-height: 25px;
    text-align: center;
    background-color: var(--accent-color);
    border-radius: 15px;
    margin-top: 10px;
    color: var(--white);
    font-size: var(--font-xs);
    font-weight: 500;
}
.bottom{
    height: 70px;
    line-height: 70px;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    font-weight: 600;
    font-size: var(--font-lg);
    border-radius: var(--radius-large);
    margin: var(--spacing-md);
    box-shadow: 0 4px 16px rgba(255, 107, 53, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.bottom:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.bottom:hover::before {
    left: 100%;
}
table,tbody,tr,td{
    border-collapse: collapse;
}
table{
    width: 100%;
}
tr {
    border-bottom: 1px solid var(--border-light);
}
tr:last-child {
    border-bottom: none;
}
td:nth-child(1) {
    color: var(--text-primary);
    font-weight: 500;
    padding: var(--spacing-sm) 0;
    width: 30%;
}
td:nth-child(2){
    width:70%;
    height: 50px;
    padding: var(--spacing-sm) 0;
    color: var(--text-secondary);
}
</style>